package com.bwei.topnews.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.bwei.topnews.R;
import com.bwei.topnews.base.MyBaseAdapter;
import com.bwei.topnews.bean.CityInfo;

import java.util.List;

/**
 * Created by qwe on 2016/11/15.
 */
public class LocalCityAdapter extends MyBaseAdapter<CityInfo>{
    public LocalCityAdapter(List list, Context context) {
        super(list, context);
    }

    @Override
    protected View initGetView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.localcity_item,null);
        TextView tv_local_city_ID = (TextView) convertView.findViewById(R.id.tv_local_city_ID);
        TextView tv_local_city_name = (TextView) convertView.findViewById(R.id.tv_local_city_name);
        if(list.get(position).isFlag()){
            tv_local_city_ID.setVisibility(View.VISIBLE);
        }else{
            tv_local_city_ID.setVisibility(View.GONE);
        }
        tv_local_city_ID.setText(list.get(position).getNamesort());
        tv_local_city_name.setText(list.get(position).getCityname());
        return convertView;
    }
}
